import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class ObjectTest {
    List<ObjectTestD> ddd = null;

    {
        ddd = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            ObjectTestD d = new ObjectTestD();
            d.setId((i + 1) * 6);
            d.setName(d.getId() + "");
            d.setArea(d.getName() + " area");
            ddd.add(d);
        }
    }

    public void a() {
        ObjectTestD c = new ObjectTestD();

        Integer index = b(c);

        System.out.println(index + "   " + c.getId() + "   " + c.getName() + " --- " + c.getArea());

    }

    public int b(ObjectTestC c) {
        Random random = new Random();
        int i = random.nextInt(3);
        c = ddd.get(i);
        return i;
    }

    public void b(Integer index, ObjectTestC c) {
        index = 6;
        c.setId(555);
        c.setName(c.getId() + "");
    }

    public static void main(String[] args) {
//        ObjectTest test = new ObjectTest();
//        test.a();
        List<ObjectTestD> dlist = new ArrayList<>();
        DD<List<ObjectTestD>> ddd = new DD<>();
        ddd.setData(dlist);

        for (int i = 0; i < 3; i++) {
            ObjectTestD d = new ObjectTestD();
            d.setId((i + 1) * 6);
            d.setName(d.getId() + "");
            d.setArea(d.getName() + " area");
            dlist.add(d);
        }

        for (ObjectTestD datum : ddd.getData()) {
            System.out.println(datum.getName());
        }


    }
}

class DD<T> {
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}